package app.lockenabler;

import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context;
import android.content.Intent;
import android.widget.RemoteViews;

public class Widget extends AppWidgetProvider
{	
    @Override
    public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds)
    {
    	RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget);
    	
    	Intent sleep = new Intent(context, LockEnabler.class);
    	Intent settings = new Intent(context, Settings.class);
    	
    	PendingIntent Sleep = PendingIntent.getActivity(context, 0, sleep, 0);
    	PendingIntent Settings = PendingIntent.getActivity(context, 0, settings, 0);
    	
    	remoteViews.setOnClickPendingIntent(R.id.icon, Sleep);
    	remoteViews.setOnClickPendingIntent(R.id.settings, Settings);
    	
    	appWidgetManager.updateAppWidget(appWidgetIds, remoteViews);
    }
}